package com.mdinfo.system.web;

import com.mdinfo.base.common.bean.CommonResult;
import com.mdinfo.system.param.RoleParam;
import com.mdinfo.system.service.IRoleService;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * Created by Administrator on 2017/11/28.
 */
@RestController
@RequestMapping("/sys/role")
public class RoleConroller {

    @Resource
    private IRoleService roleService;

    @RequestMapping("/add")
    public CommonResult<?> add(@Valid RoleParam.AddParam param){
        return roleService.add(param);
    }

    @RequestMapping("/modify")
    public CommonResult<?> modify(@Valid RoleParam.ModifyParam param){
        return roleService.modify(param);
    }

    @RequestMapping("/listQuery")
    public CommonResult<?> listQuery(@Valid RoleParam.ListQueryParam param){
        return roleService.listQuery(param);
    }

    @RequestMapping("/delete")
    public CommonResult<Void> delete(@Valid RoleParam.DeleteParam param){
        return roleService.delete(param);
    }

    @RequestMapping("/setMenu")
    public CommonResult<Void> setMenu(@Valid RoleParam.SetMenuParam param){
        return roleService.setMenu(param);
    }

    @RequestMapping("/listAll")
    public CommonResult<?> listAll(){
        return roleService.listAll();
    }
}
